﻿@model System.Collections.Generic.List<GigaSite.Domain.Entities.Category>

@{
    var level = ViewBag.level;
}

<ul class="categoryRow" data-level="@level" @(level > 0 ? "style='display: none'" : "")>
    @foreach(var category in Model.OrderBy(c => c.DisplayName))
    {
        var pathCategories = category.GetParentCategories().Skip(1).ToList();
        pathCategories.Add(category);
        
    <li data-id="@category.Id" data-path="@string.Join(" > ",pathCategories.Select(c => c.DisplayName))">
        <table width="100%">
            <tbody>
                <tr>
                    <td class="categoryTitle">
                        @category.DisplayName
                    </td>
                    <td class="categoryBullet">
                        @if (category.HasChildCategories)
                        {
                        <text>►</text>
                        }
                    </td>
                </tr>
            </tbody>
        </table>
    </li>    
    }
</ul>